<template>
  <section>
    <!--工具条-->
    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item>
          <el-input v-model="filters.name" placeholder="菜单名称"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" v-on:click="queryDept">查询</el-button>
        </el-form-item>
      </el-form>
    </el-col>

    <!--列表-->
    <el-table :data="depts" highlight-current-row v-loading="listLoading"
              @selection-change="selsChange" style="width: 100%;">
      <el-table-column type="selection" width="55">
      </el-table-column>
      <el-table-column type="index" label="序号" width="60">
      </el-table-column>
      <el-table-column prop="name" label="权限名称" >
      </el-table-column>
      <el-table-column prop="url" label="权限路径" >
      </el-table-column>
      <el-table-column prop="sn" label="权限标识" >
      </el-table-column>
      <el-table-column prop="descs" label="权限描述" >
      </el-table-column>
    </el-table>

    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="size" :total="total"
                     style="float:right;">
      </el-pagination>
    </el-col>
  </section>
</template>

<script>
import {id} from "html-webpack-plugin/lib/chunksorter";

export default {
  data() {
    return {
      filters: {
        name: ''
      },
      depts: [],
      emps: [],
      options: [],
      total: 0,
      size: 5,
      page: 1,
      listLoading: false,
      sels: [],//列表选中列
    }
  },
  methods: {
    handleCurrentChange(val) {
      this.page = val;
      this.getPermission();
    },
    queryDept() {
      this.page = 1
      this.getPermission()
    },
    getPermission() {
      let para = {
        currentPage: this.page,
        pageSize: this.size,
        keyword: this.filters.name
      };
      this.listLoading = true;
      //发送请求获取菜单信息
      this.$http.post("/permission/pageList", para).then(res => {
        console.log(res)
        if (res.data.success) {
          this.listLoading = false;
          this.depts = res.data.resultObj.data
          this.total = res.data.resultObj.count
        }
      })
    },
    selsChange: function (sels) {
      this.sels = sels;
    },
  },
  mounted() {
    this.getPermission();
  }
}

</script>

<style scoped>

</style>